import type { RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/Login.vue'),
    meta: { requiresAuth: false }
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('@/views/Register.vue'),
    meta: { requiresAuth: false }
  },
  {
    path: '/',
    name: 'Home',
    component: () => import('@/views/HomeView.vue'),
    meta: { requiresAuth: true },
    children: [
      {
        path: '',
        name: 'Welcome',
        component: () => import('@/views/dashboard/Welcome.vue'),
        meta: { requiresAuth: true }
      },
      {
        path: 'user/list',
        name: 'UserList',
        component: () => import('@/views/user/UserList.vue'),
        meta: { requiresAuth: true }
      },
      {
        path: 'user/info',
        name: 'UserInfo',
        component: () => import('@/views/user/UserInfo.vue'),
        meta: { requiresAuth: true }
      },

      {
        path: 'warehouse/list',
        name: 'WarehouseList',
        component: () => import('@/views/warehouse/WarehouseList.vue'),
        meta: { requiresAuth: true }
      },
      {
        path: 'category/list',
        name: 'CategoryList',
        component: () => import('@/views/category/CategoryList.vue'),
        meta: { requiresAuth: true }
      },
      {
        path: 'item/list',
        name: 'ItemList',
        component: () => import('@/views/item/ItemList.vue'),
        meta: { requiresAuth: true }
      },
      {
        path: 'inbound/list',
        name: 'InboundRecordList',
        component: () => import('@/views/inbound/InboundRecordList.vue'),
        meta: { requiresAuth: true }
      },
      {
        path: 'outbound/list',
        name: 'OutboundRecordList',
        component: () => import('@/views/outbound/OutboundRecordList.vue'),
        meta: { requiresAuth: true }
      },
      {
        path: 'inventory/list',
        name: 'InventoryList',
        component: () => import('@/views/inventory/InventoryList.vue'),
        meta: { 
          requiresAuth: true,
          title: '库存管理'
        }
      },
      {
        path: 'records/stats',
        name: 'RecordStats',
        component: () => import('@/views/records/RecordStats.vue'),
        meta: {
          requiresAuth: true,
          title: '出入库统计'
        }
      }
    ]
  }
]

export default routes